<?php
	include("../include/init.php");//将配置文件全部加载进来
	include("../include/check_login.php");//登录

	$insert = new sql_class("order");
	$product = new sql_class("product");
	$user = new sql_class("user");


	$pro_list = $product->select()->getAll();
	$user_list = $user->select()->getAll();
	

	if($_POST){
		$data = array(
					"order_sn"=>$_POST['order_sn'],
					"order_price"=>$_POST['order_price'],
					"order_time"=>strtotime($_POST['order_time']),
					"order_username"=>$_POST['order_username'],
					"order_phone"=>$_POST['order_phone'],
					"order_number"=>$_POST['order_number'],
					"order_date"=>strtotime($_POST['order_date']),
					"product_id"=>$_POST['product_id'],
					"user_id"=>$_POST['user_id'],
				);
		

		$insert_id = $insert->save($data);
		if($insert_id){
			show_msg("添加订单成功","order_list.php");
			exit;
		}else{
			show_msg("添加订单失败","order_add.php");
			exit;
		}
	}
	
	$smarty->assign("user_list",$user_list);
	$smarty->assign("pro_list",$pro_list);
	$smarty->display("admin/order_add.html");//连接index.html



?>